package com.xinyu.cli.example;

import picocli.CommandLine;

import java.util.concurrent.Callable;

/**
 * 用户登录
 *
 * @author: Wuxinyu
 * @date: 2024/5/14-05-14-16:40
 * @description: com.xinyu.cli.example
 * @version: 1.0
 */
public class Login implements Callable<Integer> {
    @CommandLine.Option(names = {"-u", "--user"}, description = "User name")
    String user;

    @CommandLine.Option(names = {"-p", "--password"}, description = "Passphrase", interactive = true)
    String password;

    public Integer call() throws Exception {
        // 打印出密码
        System.out.println("密码是：" + password);
        return 0;
    }

    public static void main(String[] args) {
        new CommandLine(new Login()).execute("-u", "user123", "-p");
    }
}
